#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	int a[10002]={0},b,c,d,e,f,g;
	scanf("%d %d",&c,&d);
	for(int i=1;i<=c;i++)scanf("%d",&a[i]);
	for(int i=1;i<=d;i++){
		scanf("%d",&e);
		if(e==1){
			scanf("%d",&f);
			scanf("%d",&a[f]);
		}if(e==2){
			b=1;
			scanf("%d",&f);
			for(int j=1;j<f;j++)if(a[j]<=a[f])b++;
			for(int j=f+1;j<=c;j++)if(a[j]<a[f])b++;
			printf("%d\n",b);
		}
	}return 0;
} 
